using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;
using Backend.JYD.Model;

namespace Backend.JYD.EFDAL.Mapping
{
    public class EmpInfoMap : EntityTypeConfiguration<EmpInfo>
    {
        public EmpInfoMap()
        {
            // Primary Key
            this.HasKey(t => t.EmpId);

            // Properties
            this.Property(t => t.EmpName)
                .IsRequired()
                .HasMaxLength(50);

            this.Property(t => t.LoginName)
                .HasMaxLength(50);

            this.Property(t => t.PassWord)
                .HasMaxLength(100);

            // Table & Column Mappings
            this.ToTable("EmpInfo");
            this.Property(t => t.EmpId).HasColumnName("EmpId");
            this.Property(t => t.EmpName).HasColumnName("EmpName");
            this.Property(t => t.LoginName).HasColumnName("LoginName");
            this.Property(t => t.PassWord).HasColumnName("PassWord");
            this.Property(t => t.DepartId).HasColumnName("DepartId");
            this.Property(t => t.Status).HasColumnName("Status");
            this.Property(t => t.Type).HasColumnName("Type");
            this.Property(t => t.CreateTime).HasColumnName("CreateTime");
            this.Property(t => t.UpdateTime).HasColumnName("UpdateTime");
            this.Property(t => t.OpId).HasColumnName("OpId");
        }
    }
}
